const http = require("http");
const fs = require("fs");
const path = require("path");

http.createServer((req,res)=>{
    let filePath = path.join(_dirname,"/1.txt");
    let fileRader = fs.createReadStream(filePath);
    /**
     * 这里的res对象也是可以写入的流
     */

    FileReader.pipe(res);

}).listen(8080)

console.log("server is listening 8080");